package cn.taoticket.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.taoticket.mapper.TaoticketTradeMapper;
import cn.taoticket.pojo.TaoticketTrade;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * Created by taoticket
 */
@RestController
public class RestTaoticketTradeService {

     @Autowired
     private TaoticketTradeMapper taoticketTradeMapper;

     @RequestMapping(value = "/getTaoticketTradeById",method = RequestMethod.POST)
     public TaoticketTrade getTaoticketTradeById(@RequestParam("id") Long id)throws Exception{
        return taoticketTradeMapper.getTaoticketTradeById(id);
     }

     @RequestMapping(value = "/getTaoticketTradeListByMap",method = RequestMethod.POST)
     public List<TaoticketTrade>	getTaoticketTradeListByMap(@RequestParam Map<String,Object> param)throws Exception{
        return taoticketTradeMapper.getTaoticketTradeListByMap(param);
     }

     @RequestMapping(value = "/getTaoticketTradeCountByMap",method = RequestMethod.POST)
     public Integer getTaoticketTradeCountByMap(@RequestParam Map<String,Object> param)throws Exception{
        return taoticketTradeMapper.getTaoticketTradeCountByMap(param);
     }

     @RequestMapping(value = "/qdtxAddTaoticketTrade",method = RequestMethod.POST)
     public Integer qdtxAddTaoticketTrade(@RequestBody TaoticketTrade taoticketTrade)throws Exception{
        taoticketTrade.setCreatedTime(new Date());
        return taoticketTradeMapper.insertTaoticketTrade(taoticketTrade);
     }

     @RequestMapping(value = "/qdtxModifyTaoticketTrade",method = RequestMethod.POST)
     public Integer qdtxModifyTaoticketTrade(@RequestBody TaoticketTrade taoticketTrade)throws Exception{
        taoticketTrade.setUpdatedTime(new Date());
        return taoticketTradeMapper.updateTaoticketTrade(taoticketTrade);
     }
}
